class CreateCoreRecords < ActiveRecord::Migration
  def change
    create_table :core_records do |t|
      t.integer :department_id
      t.date :create_date
      t.integer :stan
      t.date :start_date
      t.date :end_date
      t.integer :days
      t.integer :crdtype
      t.string :crdid
      t.string :desc
      t.integer :acid
      t.integer :acidr
      t.decimal :amount, precision: 16, scale: 4
      t.string :cust_name
      t.string :mobile
      t.string :account
      t.date :open_date
      t.integer :acc_type

      t.timestamps null: false
    end

    add_index :core_records, [:department_id, :create_date, :stan]
  end
end
